<%@ page import="bidsanity.Bid; bidsanity.Listing" contentType="text/html;charset=UTF-8" %>
<html>
<head>
    <meta name="layout" content="main"/>
    <title>- Bids</title>
</head>

<body>
<h1>Bids</h1>

<g:if test="${flash.message}">
    <div class="message">${flash.message}</div>
</g:if>

<table class="data_table">
    <tr>
        <th>Listing Name</th>
        <th>Bidder</th>
        <th>Amount</th>
        <th>Date</th>
    </tr>
    <g:each in="${bidInstanceList}" status="i" var="bid">
        <tr class="${(i % 2) == 0 ? 'even' : 'odd'}">
            <td><g:link controller="Listing" action="show" id="${bid.listing.id}">${bid.listing.name.encodeAsHTML()}</g:link></td>
            <td><g:link controller="Customer" action="show" id="${bid.bidder.id}">${bid.bidder.getNameFromEMail().encodeAsHTML()}</g:link></td>
            <td><g:formatNumber number="${bid.amount}" type="currency" currencyCode="USD"/></td>
            <td><g:formatDate date="${bid.bidTime}" format="MMM d h:mma" /></td>
        </tr>
    </g:each>
</table>

<p>Total Number of Bids: ${bidInstanceTotal}</p>
</body>
</html>